var Vuex = {
  state: {
    name: '',
    age: 10
  },
  getters: {
    doneTodos: function () {
      return this.state.name + 'hahahah'
    }
  },
  actions: {
    changeName: function (val) {
      console.log('在此做一些记录')
      this.state.name = val
    },
    addAge: function () {
      this.state.age++
    },
    reduceAge: function(){
      this.state.age--
    }
  }
}

Vue.use(Vuex)     // Vue.prototype.store = Vuex
var obj = new Vue()

var getName = obj.store.state.name
var hhahahName = obj.store.getters.doneTodos()
obj.store.actions.changeName('lsf')

$.ajax({
  url: 'dsadasdasd',
  async: true,
  success: function(result){
    obj.store.actions.addAge()
  }
})

$.ajax({
  url: 'dsadasd',
  async: true,
  success: function(){
    obj.store.actions.reduceAge()
  }
})
